#!/usr/bin/python
#-*- coding: utf-8  -*- 
#测试套件，可以加入多个测试集

import unittest,doctest,os
import test_site_monitor
import test_service_monitor
import test_user_manage_demo
import test_site_monitor_demo
from utils_qa import HTMLTestRunner
import sys
reload(sys)
# sys.setdefaultencoding('utf-8')
suite = doctest.DocTestSuite  
suite = unittest.TestSuite()  
# suite.addTest(unittest.makeSuite(test_site_monitor.TestSiteMonitorSmoke))#引入测试的类，测试用例就被包含在类中  
# suite.addTest(unittest.makeSuite(test_service_monitor.TestServiceMonitorSmoke))
suite.addTest(unittest.makeSuite(test_user_manage_demo. TestUserManageSmoke))
suite.addTest(unittest.makeSuite(test_site_monitor_demo.TestSiteMonitorSmoke))
# suite.addTest(unittest.makeSuite(regWithDevice.testRegWithDevice))  
#unittest.TextTestRunner(verbosity=2).run(suite) #这是只运行，不生成报告的做法  
# 获取上层文件路径
dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
print dir 
filename =dir +'/report/result.html' #定义报告路径  
fp = file(filename,'wb') #定义报告文件权限，wb，表示有读写权限  
runner = HTMLTestRunner.HTMLTestRunner(  
        stream = fp,  
        title ='Just_Test',  
        description = 'Report_discription')  
  
runner.run(suite)#执行测试  
fp.close()#关闭文件，否则会无法生成文件 
